//
//  WSSearchBar.h
//  WSComponent
//
//  Created by lienbao on 25/08/2014.
//  Copyright (c) 2014 Lienbao. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "UISearchBar+removeBackgroundView.h"
#import "WSTableViewCell.h"

@class WSSearchBar;

@protocol WSSearchBarDelegate <NSObject>

@optional

-(void)didSelected:(WSSearchBar *)searchBar keyWord:(id)keyWord;
-(void)didSearch:  (WSSearchBar *)searchBar keyWord:(NSString *)keyWord;
-(void)didClicked: (WSSearchBar *)searchBar button:(UIButton *)btn;

@end

@interface WSSearchBar : UIView

@property (nonatomic, assign)   UIEdgeInsets edgeInsets;
@property (nonatomic, readonly) UISearchBar *searchBar;
@property (nonatomic, readonly) UITableView *tableView;
@property (nonatomic, strong)   NSMutableArray *searchResults;
@property (nonatomic, strong)   UIButton *leftButton;
@property (nonatomic, strong)   UIButton *rightButton;
@property (nonatomic, strong)   UIButton *cancelButton;
@property (nonatomic, weak)     id<WSSearchBarDelegate>   delegate;
@property (nonatomic)   CGRect resultFrame;
@property (nonatomic, strong)   NSString *tableViewCellClassName;

- (id)initWithFrame:(CGRect)frame withViewController:(UIViewController *)viewController;

- (void)resetStatus;

- (void)clear;

- (void)layoutSearchBarSubviews;

- (void)reloadData;

@end
